<!--//
		<h4 style="visibility: visible; margin-bottom: 0px;"><span class="discovery_head_span"><?php echo _ENVIRONMENT; ?></span> <?php echo _ASSESSMENT; ?></h4>
		<br />
//-->
	<br />
	<h3 style="visibility: visible; text-align: center;"><span><?php echo _ENVIRONMENT; ?></span> <?php echo _DISCOVERY .' '. _DASHBOARD; ?></h3>


			<?php

				$total = 0;
				$sp	= ini_get( 'session.save_path' );

				/*********************************************************************
				** Requirements test cases (13 = 0 thru' 12) needed to make 100%
				** true? then add to total else if false, post to the Message Center
				**
				** IMPORTANT:
				** If new test cases added, update the $ScaleMax variable
				*********************************************************************/

				// Tests Max. Score  (Note: 0 thru' 12 = 13 test cases)
				$scaleMax = 12;  


				// Basic needs
				if (is_writable( $sp )) { ($total++); } else { $msgctr_WARNING .= '<p class="warning">TSW-'. _SAVE_SESSIONPATH_INSTALLNOTE .'</p>'; }
				if (ini_get('display_errors')) { ($total++); } //else { ($total++); $msgctr_NOTICE .= '<p class="notice">TSN-<b>display_errors</b> '. _DISPLAY_ERRORS_INSTALLNOTE .'</p>'; }
				if (!ini_get('register_globals')) { ($total++); } else { ($total = 0); $msgctr_ERROR .= '<p class="error">TSE-'. _REGISTER_GLOBALS_INSTALLNOTE .' '. $discovered_APP .'</p>'; }
				if (!ini_get('safe_mode')) { ($total++); } else { $msgctr_WARNING .= '<p class="warning">TSW-'. _SAFE_MODE_INSTALLNOTE .' '. $discovered_APP .'</p>'; }

				// Advanced needs
				if (!ini_get('file_uploads')) { ($total++); } else { $msgctr_NOTICE .= '<p class="notice">TSN-'. _FILE_UPLOADS_INSTALLNOTE .'</p>'; }
				if (!ini_get('magic_quotes_gpc')) { ($total++); } else { $msgctr_WARNING .= '<p class="warning">TSW-'. _MAGIC_QUOTES_INSTALLNOTE .'</p>'; }
				if (!ini_get('magic_quotes_runtime')) { ($total++); } else { $msgctr_NOTICE .= '<p class="notice">TSN-'. _MAGIC_QUOTESRT_INSTALLNOTE .'</p>'; }
				if (ini_get('output_buffering')) { ($total++); } else { ($total++); $msgctr_NOTICE .= '<p class="notice">TSN-'. _OUTPUT_BUFFER_INSTALLNOTE .'</p>'; }
				if (!ini_get('session_autostart')) { ($total++); } else { $msgctr_WARNING .= '<p class="warning">TSW-'. _SESSION_AUTOSTART_INSTALLNOTE .'</p>'; }

				// ShowStoppers - Progressivly sets Installation Assessment to 0% if not true, posting a not possible message
				if (extension_loaded('zlib')) { ($total++); } else { ($total = 0); $msgctr_WARNING .= '<p class="warning">TSW-'. _ZLIB_INSTALLNOTE .' '. $discovered_APP .'</p>'; }
				if (!extension_loaded('xml')) { ($total++); } else { ($total = 0); $msgctr_ERROR .= '<p class="error">TSE-'. _XML_INSTALLNOTE .' '. $discovered_APP .'</p>'; }
    			if (function_exists( 'mysql_connect' )) { ($total++); } else { ($total = 0); $msgctr_ERROR .= '<p class="error">TSE-'. _MYSQL_INSTALLNOTE .' '. $discovered_APP .'</p>'; }
				if (phpversion() > '4.1') { ($total++); } else { ($total = 0); $msgctr_ERROR .= '<p class="error">TSE-'. _PHP_LEVEL_INSTALLNOTE .' '. $discovered_APP .'</p>'; }

			?>




<table border="0" cellpadding="0" cellspacing="1" width="296px" align="center">

<?php

	$colorChoice = '#C0C0C0';

	/********************************************************************* 
	** TESTING PURPOSES ONLY
	** Uncomment and modify this value to simulate the Scale output (0-12) 
	*********************************************************************/
	//$total = 12;
	
	/********************************************************************* 
	** Just a little protection to avoid any buffer overuns
	** if the $total (above) score exceeds the maximum score possible 
	** (how, I don't know! Maybe incorrectly set in testing?) then kill it  
	*********************************************************************/
	if ( $total > $scaleMax ) {
		echo '<p class="error"><b>TSE: 000F: Fatal Error:</b><br />Application scoreTotal exceeded scoreMax allowed.<br />Did you accidentally make the scoreTotal exceed the scoreMax  possible in TestMode?</p>';
		exit;
		}


	// Tests Actual Score
	$scaleTotal = $total;
	$scaleFinish = ( $scaleTotal );	

	// Work out the Test Case (total) percentage value
	$scaleSuccess = number_format(($scaleFinish/$scaleMax)*100,0) .'%';
	// Set up score above user environment score and display and -off image
	$scaleImage = 'css/images/symbol-delete-off.png';

		// Start the empty scale display, if the app doesn't get rated this high
		while ( ( $scaleMax >= ( $scaleFinish +1 ) ) ) {

			echo '<tr>';
			echo '<td align="left" valign="bottom" height="30px" width="48px" style="background: white url('. $scoreImage .') no-repeat top right">&nbsp;</td>';
			echo '<td height="30px" width="48px" style="background: white url('. $scaleImage .') no-repeat center; border-bottom: 1px solid '. $colorChoice .'; border-right: 1px solid '. $colorChoice .'; color: '. $colorChoice .';">&nbsp;</td>';
echo '<td class="cell_data" width="200px" style="border-bottom: none; line-height: 100%; font-size: 10px; padding-left: 10px; border-bottom: 1px solid '. $colorChoice .'; border-right: 1px solid '. $colorChoice .'; color: '. $colorChoice .';">'. $scale_MESSAGE .'</td>';
			echo '<tr>';

		$scaleFinish++;
		}


	// Start the actaul app's rating scale
	$scaleStart = 0;

	while ( $scaleStart <= $scaleTotal ) {

	$scaleTally = $scaleTotal - $scaleStart;

		if ( $scaleTotal == $scaleTally) {

			// set the pointer icon to the final rating in the left-hand column
			$scoreImage = 'css/images/arrow-left.png';
			$showScore = '';
			$scale_MESSAGE = '';

			// Correct the message prefix if it is Pre-Instalaltion, else display the discovered application ame
			if ( $discovered_APP == 'preinstall' ) {
				$msg_PREFIX = 'Your application';
				} else {
					$msg_PREFIX = $discovered_APP;
					}
				
				// tell the user how we think the app will perform and if the environment conforms to the minimum requirements
				if ( $scaleTally <= 0 ) {
					$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_0;
					$showScore = $scaleSuccess;
					$colorChoice = '#840000';

					} else if ( $scaleTally <= 3 ){
						$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_25;					
						$showScore = $scaleSuccess;
						$colorChoice = '#840000';

						} else if ( $scaleTally <= 5 ){
							$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_40;					
							$showScore = $scaleSuccess;
							$colorChoice = '#840000';

							} else if ( $scaleTally <= 6 ){
								$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_50;				
								$showScore = $scaleSuccess;
								$colorChoice = '#004080';

								} else if ( $scaleTally <= 8 ){
									$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_65;				
									$showScore = $scaleSuccess;
									$colorChoice = '#004080';

									} else if ( $scaleTally <= 9 ){
										$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_75;
										$showScore = $scaleSuccess;
										$colorChoice = '#004080';
	
										} else if ( $scaleTally <= 10 ){
											$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_85;					
											$showScore = $scaleSuccess;
											$colorChoice = '#004080';

											} else if ( $scaleTally <= 11 ){
												$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_95;					
												$showScore = $scaleSuccess;
												$colorChoice = '#008040';

												} else if ( $scaleTally <= 12 ){
													$scale_MESSAGE .= $msg_PREFIX .' '. _INSTALL_SCALE_GT95 .' '. $msg_PREFIX .'.';
													$showScore = $scaleSuccess;			
													$colorChoice = '#008040';

													} else {
														$scale_MESSAGE .= '<p class="warning">Ooops! There\'s been an error in my maths.</p>';
														$showScore = $scaleSuccess;

				}


				// post an Activity Centre message pointing the user to the Messages in the Message Centre if required
				if ( $scaleTally != 12 ) {
					$actmsg_MESSAGE .= '<p class="action">TSA-'. _actmsg_REFER_MSGCTR .'</p>';												
					}


			} else {
				// or don't set anything in the left-hand column
				$scoreImage = 'none';
				$scale_MESSAGE = '&nbsp;';
				$showScore = '';
				$colorChoice = '#C0C0C0';
		}


				// set the right-hand column rating icons
				if ( $scaleTally == $scaleMax ) {
					// app made 100%
					$scaleImage = 'css/images/symbol-check.png';

					} else if  ($scaleTally <= 0) {
						// app made 0%
						$scaleImage = 'css/images/symbol-stop.png';
						$scale_MESSAGE = $msg_PREFIX .' '. _INSTALL_SCALE_0;
	
						} else if  ($scaleTally == 10) {
							// app made 85%
							$scaleImage = 'css/images/symbol-information.png';
							$scale_MESSAGE = $msg_PREFIX .' '. _INSTALL_SCALE_85;

							} else if  ($scaleTally == 6) {
								// app made 50%
								$scaleImage = 'css/images/symbol-help.png';
								$scale_MESSAGE = $msg_PREFIX .' '. _INSTALL_SCALE_50;

								} else if  ($scaleTally == 3) {
									// app made 25%
									$scaleImage = 'css/images/symbol-restricted.png';
									$scale_MESSAGE = $msg_PREFIX .' '. _INSTALL_SCALE_25;

									} else if ( $scaleTally == $scaletotal ) {
										$scaleImage = 'css/images/look_24.png';

										} else if ($scaleTally < 12) {
											$scaleImage = 'css/images/arrowup.png';

											} else {
												$scaleImage = 'css/images/arrowup.png';

				}

		echo '<tr>';
		echo '<td align="left" valign="bottom" height="30px" width="48px" style="background: white url('. $scoreImage .') no-repeat top right; font-size: 12px; color: #004080;"><b>'. $showScore .'</b></td>';
		echo '<td height="30px" width="48px" style="background: white url('. $scaleImage .') no-repeat center; border-bottom: 1px solid '. $colorChoice .'; border-right: 1px solid '. $colorChoice .';">&nbsp;</td>';
echo '<td class="cell_data" width="200px" style="border-bottom: none; line-height: 100%; font-size: 10px; padding-left: 10px; border-bottom: 1px solid '. $colorChoice .'; border-right: 1px solid '. $colorChoice .'; color: '. $colorChoice .';">'. $scale_MESSAGE .'</td>';
		echo '<tr>';

	$scaleStart++;
	}
?>

</table>


<?php
	echo '<p align="right"><a href="#"><img src="css/images/symbol-help.png" height="18px" width="18px" alt="'. _WHATSTESTED .'"></a></p>';
	//echo $dashmsg_MESSAGE .'<br />';
?>